<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>css动画实现</title>
	<style type="text/css" media="screen">
		div{
			height: 100px;width: 100px;border: 1px solid black;
		}
		div:hover{
			animation: 1s rainbow infinite;
		}

		@keyframes rainbow{
			0%{background-color: #c00}
			50%{background-color: orange;}
			100%{background-color: yellowgreen;}
		}

		@keyframes typing { from { width: 0; } }
		@keyframes blink-caret { 50% { border-color: transparent; } }

		h1 { 
			font: bold 200% Consolas, Monaco, monospace;
			border-right: .1em solid;
			width: 16.5em; /* fallback */
			width: 30ch; /* # of chars */
			margin: 2em 1em;
			white-space: nowrap;
			overflow: hidden;
			animation: typing 20s steps(30, end), /* # of steps = # of chars */
			blink-caret .5s step-end infinite alternate;
		}
	</style>
</head>
<body>
	<div>
		
	</div>
	<h1>Typing animation by Lea Verou.</h1>
	
</body>
</html>